<template>
	<view>
		<web-view :src="src"></web-view>
	</view>
</template>

<script>
	import {
		baseUrl
	} from '@/common/config'
	export default {
		data() {
			return {
				src: '',
				title: ''
			}
		},
		methods: {
			setTitle() {
				const eventChannel = this.getOpenerEventChannel()
				eventChannel.on('setTitle', function(data) {
					uni.setNavigationBarTitle({
						title: data
					})
				})
			}
		},
		onLoad(params) {

      const url = decodeURIComponent(params.url)
			if (params.url) {
				this.src = url
			}
			if (params.type) {
				let url = 'https://oms.atlastire.cn/#/shareWriteOffCode'
				if (baseUrl.indexOf("-uat") != -1) {
					url = 'http://aoms-uat.linglong.cn/#/shareWriteOffCode'
				} else if(baseUrl.indexOf("-sit") != -1){
					url = "http://oms-sit.ehzcloud.com/#/shareWriteOffCode"
				}
				this.src =`${url}?orderNo=${encodeURIComponent(params.orderNo)}&env=${encodeURIComponent(baseUrl)}`
			}
			if(params.shareId){
				let url = 'https://oms.atlastire.cn/#/h5Register'
				if (baseUrl.indexOf("-uat") != -1) {
					url = 'http://oms-uat.atlastire.cn/#/h5Register'
				} else if(baseUrl.indexOf("-sit") != -1){
					url = "http://oms-sit.ehzcloud.com/#/h5Register"
				}
				this.src =`${url}?shareId=${encodeURIComponent(params.shareId)}`
			}
		}
	}
</script>
